/**
 * 
 */
package cz.cuni.mff.abacs.burglar.logics.planning;

import cz.cuni.mff.abacs.burglar.logics.planning.instructions.Instruction;
import cz.cuni.mff.abacs.burglar.visual.Main;


/**
 * 
 * 
 * @author abacs
 *
 */
public abstract class PlannerHandlerBase {
	
	/** Linux specific */
	protected static int EXIT_VALUE_SUCCESS = 0;
	
	/** '/' terminated path to the problems directory. */
	protected static final String PROBLEMS_PATH = 
		Main.PLANNER_PATH + "pddl/problems/";

	protected static final String STR_MOVE_TO = "MOVE_TO";
	protected static final String STR_ENTER_DOOR = "ENTER_DOOR";
	protected static final String STR_OPEN = "OPEN";
	protected static final String STR_CLOSE = "CLOSE";
	protected static final String STR_UNLOCK = "UNLOCK";
	protected static final String STR_LOCK = "LOCK";
	protected static final String STR_PICK_FROM = "PICK_FROM";
	
	
	// -------------------------------------------------------------------------
	
	
	/**
	 * Translates the instruction code.
	 * 
	 * @param instruction string representation of the instruction name
	 * @return 
	 */
	protected static Instruction.code getInstructionCode(String instruction) {
		
		if(instruction.equals(SGPLANHandler.STR_MOVE_TO))
			return Instruction.code.COMPLEX_MOVE;
		if(instruction.equals(SGPLANHandler.STR_OPEN))
			return Instruction.code.OPEN;
		if(instruction.equals(SGPLANHandler.STR_CLOSE))
			return Instruction.code.CLOSE;
		if(instruction.equals(SGPLANHandler.STR_UNLOCK))
			return Instruction.code.UNLOCK;
		if(instruction.equals(SGPLANHandler.STR_LOCK))
			return Instruction.code.LOCK;
		if(instruction.equals(SGPLANHandler.STR_PICK_FROM))
			return Instruction.code.PICK_UP;
		if(instruction.equals(SGPLANHandler.STR_ENTER_DOOR))
			return Instruction.code.ENTER_DOOR;
		
		return Instruction.code.UNDEFINED;
	}
	
	
}
